# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     find_corner_point
   Description :
   Author :       'li'
   date：          2021/7/4
-------------------------------------------------
   Change Activity:
                   2021/7/4:
-------------------------------------------------
"""
import numpy as np

from ml.cv.algorithms.bbox_generate.corner_to_bbox.util import get_vector_angle


class VectorAngleFinder:
    def __init__(self, vectors):
        """

        """
        self.vectors = vectors
        self.vectors_angle = get_vector_angle(self.vectors)

    def get_min_angle_point(self):
        lo = np.argmin(self.vectors_angle)
        return self.vectors[lo]

    def get_max_angle_point(self):
        lo = np.argmax(self.vectors_angle)
        return self.vectors[lo]


def _main():
    vectors = np.array([[1, 1], [-1, 1], [-1, -1], [1, -1]])
    res = VectorAngleFinder(vectors).get_max_angle_point()
    print(res)


if __name__ == '__main__':
    _main()
